home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / jikes.lha / jikes-1.11 / src / config.cpp < prev    next >
C/C++ Source or Header  |  2000-01-16  |  40KB  |  1,003 lines

  1. // $Id: config.cpp,v 1.33 2000/01/06 06:46:47 lord Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10. #include "config.h"
  11. #include "long.h"
  12. #include "double.h"
  13.  
  14. IntToString::IntToString(int num)
  15. {
  16.     if (num == 0x80000000)
  17.     {
  18.         str = info;
  19.         strcpy(str, StringConstant::U8S_smallest_int);
  20.     }
  21.     else
  22.     {
  23.         str = &info[TAIL_INDEX];
  24.         *str = U_NULL;
  25.         int n = (num < 0 ? -num : num);
  26.         do
  27.         {
  28.             *--str = (U_0 + n % 10);
  29.             n /= 10;
  30.         } while (n != 0);
  31.  
  32.         if (num < 0)
  33.             *--str = U_MINUS;
  34.     }
  35.  
  36.     return;
  37. }
  38.  
  39.  
  40. IntToWstring::IntToWstring(int num)
  41. {
  42.     if (num == 0x80000000)
  43.     {
  44.         wstr = winfo;
  45.         wcscpy(wstr,  StringConstant::US_smallest_int);
  46.     }
  47.     else
  48.     {
  49.         wstr = &winfo[TAIL_INDEX];
  50.         *wstr = U_NULL;
  51.         int n = (num < 0 ? -num : num);
  52.         do
  53.         {
  54.             *--wstr = (U_0 + n % 10);
  55.             n /= 10;
  56.         } while (n != 0);
  57.  
  58.         if (num < 0)
  59.             *--wstr = U_MINUS;
  60.     }
  61.  
  62.     return;
  63. }
  64.  
  65.  
  66. ULongToDecString::ULongToDecString(ULongInt &num)
  67. {
  68.     str = &info[TAIL_INDEX];
  69.     *str = U_NULL;
  70.  
  71.     ULongInt n = num; // make a copy in order to not destroy reference argument
  72.     do
  73.     {
  74.         *--str = U_0 + (n % 10).LowWord();
  75.         n /= 10;
  76.     } while (n != 0);
  77.  
  78.     return;
  79. }
  80.  
  81.  
  82. LongToOctString::LongToOctString(BaseLong &num)
  83. {
  84.     str = &info[TAIL_INDEX];
  85.     *str = U_NULL;
  86.  
  87.     ULongInt n = num; // make a copy in order to not destroy reference argument
  88.     do
  89.     {
  90.         *--str = U_0 + (n % 8).LowWord();
  91.         n /= 8;
  92.     } while (n != 0);
  93.  
  94.     *--str = U_0;
  95.  
  96.     return;
  97. }
  98.  
  99.  
  100. LongToHexString::LongToHexString(BaseLong &num)
  101. {
  102.     str = &info[TAIL_INDEX];
  103.     *str = U_NULL;
  104.  
  105.     ULongInt n = num; // make a copy in order to not destroy reference argument
  106.     do
  107.     {
  108.         *--str = U_0 + (n % 16).LowWord();
  109.         n /= 16;
  110.     } while (n != 0);
  111.  
  112.     *--str = U_x;
  113.     *--str = U_0;
  114.  
  115.     return;
  116. }
  117.  
  118.  
  119. LongToDecString::LongToDecString(LongInt &num)
  120. {
  121.     if (num.HighWord() == 0x80000000 && num.LowWord() == 0x00000000)
  122.     {
  123.         str = info;
  124.         strcpy(str,  StringConstant::U8S_smallest_long_int);
  125.     }
  126.     else
  127.     {
  128.         str = &info[TAIL_INDEX];
  129.         *str = U_NULL;
  130.  
  131.         ULongInt n = (num.HighWord() == 0x80000000 ? (LongInt) (-num) : num); // compute the absolute value
  132.  
  133.         do
  134.         {
  135.             *--str = U_0 + (n % 10).LowWord();
  136.             n /= 10;
  137.         } while (n != 0);
  138.  
  139.         if (num.HighWord() & 0x80000000)
  140.             *--str = U_MINUS;
  141.     }
  142.  
  143.     return;
  144. }
  145.  
  146.  
  147. //
  148. // Convert an double to its character string representation.
  149. //
  150. FloatToString::FloatToString(IEEEfloat &num)
  151. {
  152.     if (num.IsNaN())
  153.     {
  154.          strcpy(str,"NaN");
  155.          length = strlen("NaN");
  156.     }
  157.     else if (num.IsNegativeInfinity())
  158.     {
  159.          strcpy(str,"-Infinity");
  160.          length = strlen("-Infinity");
  161.     }
  162.     else if (num.IsPositiveInfinity())
  163.     {
  164.          strcpy(str,"Infinity");
  165.          length = strlen("Infinity");
  166.     }
  167.     else if (num.IsNegativeZero())
  168.     {
  169.          strcpy(str,"-0.0");
  170.          length = strlen("-0.0");
  171.     }
  172.     else if (num.IsPositiveZero())
  173.     {
  174.          strcpy(str,"0.0");
  175.          length = strlen("0.0");
  176.     }
  177.     else
  178.     {
  179.         //
  180.         // TODO: This conversion is a temporary patch. Need volunteer to implement
  181.         //       better algorithm:
  182.         //
  183.         //            Burger/Dybvig, PLDI 1996
  184.         //            Steele/White,  PLDI 1990
  185.         //
  186.         // If the absolute value f of the number in question is outside of the range 
  187.         //
  188.         //         1E-3 <= f < 1E+7
  189.         //
  190.         // we write the number out in "computerized scientific notation".
  191.         // Otherwise, we write it out in standard form.
  192.         //
  193.         int decimal_exponent = 0;
  194.         float f = (num.IsNegative() ? -num.FloatValue() : num.FloatValue());
  195.         if (f < 1E-3 || f >= 1E+7)
  196.         {
  197.             //
  198.             // The value of the number f can be expressed as
  199.             //
  200.             //     mantissa * (2 ** num.Exponent())
  201.             //
  202.             // But we really need to express it as:
  203.             //
  204.             //     mantissa * (10 ** decimal_exponent)
  205.             //
  206.             decimal_exponent = (int) ceil(num.Exponent() * log10(2.0));
  207.             f *= pow(10.0, -decimal_exponent); // shift f until it has precisely one decimal digit before the dot
  208.             if (floor(f) == 0.0)
  209.             {
  210.                 decimal_exponent--;
  211.                 f *= 10.0;
  212.             }
  213.  
  214.             assert(floor(f) > 0.0f && floor(f) < 10.0f); // make sure there is only one digit !!!
  215.         }
  216.  
  217.         char *s = str;
  218.         if (num.IsNegative()) // if the number is negative, add the minus sign
  219.             *s++ = U_MINUS;
  220.  
  221.         //
  222.         // convert whole part into its string representation
  223.         //
  224.         IntToString whole((int) f);
  225.  
  226.         char *ptr = whole.String();
  227.         while(*ptr)
  228.             *s++ = *ptr++;
  229.         *s++ = U_DOT;
  230.  
  231.         //
  232.         // Convert fractional part to its string representation
  233.         //
  234.         int limit = MAXIMUM_PRECISION + (num.IsNegative() ? 2 : 1);
  235.         float fraction = f - ((int) f);
  236.         do
  237.         {
  238.             fraction *= 10.0;
  239.             *s++ = U_0 + ((int) fraction);
  240.             fraction -= ((int) fraction);
  241.         } while((fraction > 0.0) && (s - str) < limit);
  242.  
  243.         //
  244.         // For each leading 0, add a little more precision.
  245.         // There can be at most 3.
  246.         // 
  247.         char *last = s - 1;
  248.         for (int i = 0; i < 3 && floor(f) == 0.0 && *last != U_0; i++)
  249.         {
  250.             f *= 10.0;
  251.             fraction *= 10.0;
  252.             last = s;
  253.             *s++ = U_0 + ((int) fraction);
  254.             fraction -= ((int) fraction);
  255.         }
  256.  
  257.         //
  258.         // Round if necessary
  259.         //
  260.         if (fraction >= 0.5)
  261.         {
  262.             while (*last == U_9)
  263.                 *last-- = U_0;
  264.             char *dot_character = (*last == U_DOT ? last : (char *) NULL);
  265.             if (dot_character)
  266.             {
  267.                 last--;
  268.                 while (last >= str && *last == U_9)
  269.                     *last-- = U_0;
  270.             }
  271.  
  272.             if (last < str)
  273.             {
  274.                 *++dot_character = U_DOT; // move dot over 1 place
  275.                 *str = 1;                 // place a 1 in the first position
  276.                 *s++ = U_0;               // add an extra zero at the end.
  277.             }
  278.             else (*last)++; // increment the number in the last position
  279.         }
  280.  
  281.         //
  282.         // Remove all excess trailing zeroes
  283.         //
  284.         while (*--s == U_0)
  285.             ;
  286.         s += (*s == U_DOT ? 2 : 1); // need at least one digit after the dot.
  287.  
  288.         //
  289.         // If the number is to be written out in scientific notation, add the exponent
  290.         //
  291.         if (decimal_exponent != 0)
  292.         {
  293.             *s++ = U_E;
  294.             IntToString exponent(decimal_exponent);
  295.             char *ptr = exponent.String();
  296.             while (*ptr)
  297.                 *s++ = *ptr++;
  298.         }
  299.  
  300.         *s = U_NULL;      // close string
  301.         length = s - str; // compute length
  302.     }
  303.  
  304.     assert(length <= MAXIMUM_STR_LENGTH);
  305.  
  306.     return;
  307. }
  308.  
  309.  
  310. //
  311. // Convert an double to its character string representation.
  312. //
  313. DoubleToString::DoubleToString(IEEEdouble &num)
  314. {
  315.     if (num.IsNaN())
  316.     {
  317.          strcpy(str,"NaN");
  318.          length = strlen("NaN");
  319.     }
  320.     else if (num.IsNegativeInfinity())
  321.     {
  322.          strcpy(str,"-Infinity");
  323.          length = strlen("-Infinity");
  324.     }
  325.     else if (num.IsPositiveInfinity())
  326.     {
  327.          strcpy(str,"Infinity");
  328.          length = strlen("Infinity");
  329.     }
  330.     else if (num.IsNegativeZero())
  331.     {
  332.          strcpy(str,"-0.0");
  333.          length = strlen("-0.0");
  334.     }
  335.     else if (num.IsPositiveZero())
  336.     {
  337.          strcpy(str,"0.0");
  338.          length = strlen("0.0");
  339.     }
  340.     else
  341.     {
  342.         //
  343.         // TODO: This conversion is a temporary patch. Need volunteer to implement
  344.         //       better algorithm:
  345.         //
  346.         //            Burger/Dybvig, PLDI 1996
  347.         //            Steele/White,  PLDI 1990
  348.         //
  349.         // If the absolute value d of the number in question is outside of the range 
  350.         //
  351.         //         1E-3 <= d < 1E+7
  352.         //
  353.         // we write the number out in "computerized scientific notation".
  354.         // Otherwise, we write it out in standard form.
  355.         //
  356.         int decimal_exponent = 0;
  357.         double d = (num.IsNegative() ? -num.DoubleValue() : num.DoubleValue());
  358.         if (d < 1E-3 || d >= 1E+7)
  359.         {
  360.             //
  361.             // The value of the number f can be expressed as
  362.             //
  363.             //     mantissa * (2 ** num.Exponent())
  364.             //
  365.             // But we really need to express it as:
  366.             //
  367.             //     mantissa * (10 ** decimal_exponent)
  368.             //
  369.             decimal_exponent = (int) ceil(num.Exponent() * log10(2.0));
  370.             d *= pow(10.0, -decimal_exponent); // shift f until it has precisely one decimal digit before the dot
  371.             if (floor(d) == 0.0)
  372.             {
  373.                 decimal_exponent--;
  374.                 d *= 10.0;
  375.             }
  376.  
  377.             assert(floor(d) > 0.0 && floor(d) < 10.0); // make sure there is only one digit !!!
  378.         }
  379.  
  380.         char *s = str;
  381.         if (num.IsNegative()) // if the number is negative, add the minus sign
  382.             *s++ = U_MINUS;
  383.  
  384.         //
  385.         // convert whole part into its string representation
  386.         //
  387.         IntToString whole((int) d);
  388.  
  389.         char *ptr = whole.String();
  390.         while(*ptr)
  391.             *s++ = *ptr++;
  392.         *s++ = U_DOT;
  393.  
  394.         //
  395.         // Convert fractional part to its string representation
  396.         //
  397.         int limit = MAXIMUM_PRECISION + (num.IsNegative() ? 2 : 1);
  398.         double fraction = d - ((int) d);
  399.         do
  400.         {
  401.             fraction *= 10.0;
  402.             *s++ = U_0 + ((int) fraction);
  403.             fraction -= ((int) fraction);
  404.         } while((fraction > 0.0) && (s - str) < limit);
  405.  
  406.         //
  407.         // For each leading 0, add a little more precision.
  408.         // There can be at most 3.
  409.         // 
  410.         char *last = s - 1;
  411.         for (int i = 0; i < 3 && floor(d) == 0.0 && *last != U_0; i++)
  412.         {
  413.             d *= 10.0;
  414.             fraction *= 10.0;
  415.             last = s;
  416.             *s++ = U_0 + ((int) fraction);
  417.             fraction -= ((int) fraction);
  418.         }
  419.  
  420.         //
  421.         // Round if necessary
  422.         //
  423.         if (fraction >= 0.5)
  424.         {
  425.             while (*last == U_9)
  426.                 *last-- = U_0;
  427.             char *dot_character = (*last == U_DOT ? last : (char *) NULL);
  428.             if (dot_character)
  429.             {
  430.                 last--;
  431.                 while (last >= str && *last == U_9)
  432.                     *last-- = U_0;
  433.             }
  434.  
  435.             if (last < str)
  436.             {
  437.                 *++dot_character = U_DOT; // move dot over 1 place
  438.                 *str = 1;                 // place a 1 in the first position
  439.                 *s++ = U_0;               // add an extra zero at the end.
  440.             }
  441.             else (*last)++; // increment the number in the last position
  442.         }
  443.  
  444.         //
  445.         // Remove all excess trailing zeroes
  446.         //
  447.         while (*--s == U_0)
  448.             ;
  449.         s += (*s == U_DOT ? 2 : 1); // need at least one digit after the dot.
  450.  
  451.         //
  452.         // If the number is to be written out in scientific notation, add the exponent
  453.         //
  454.         if (decimal_exponent != 0)
  455.         {
  456.             *s++ = U_E;
  457.             IntToString exponent(decimal_exponent);
  458.             char *ptr = exponent.String();
  459.             while (*ptr)
  460.                 *s++ = *ptr++;
  461.         }
  462.  
  463.         *s = U_NULL;      // close string
  464.         length = s - str; // compute length
  465.     }
  466.  
  467.     assert(length <= MAXIMUM_STR_LENGTH);
  468.  
  469.     return;
  470. }
  471.  
  472.  
  473. Ostream &Ostream::operator<<(LongInt a)
  474. {
  475.     if (os -> flags() & os -> dec)
  476.     {
  477.         LongToDecString long_int(a);
  478.         *os << long_int.String();
  479.     }
  480.     else if (os -> flags() & os -> oct)
  481.     {
  482.         LongToOctString long_int(a);
  483.         *os << (os -> flags() & os -> showbase ? long_int.StringWithBase() : long_int.String());
  484.     }
  485.     else if (os -> flags() & os -> hex)
  486.     {
  487.         LongToHexString long_int(a);
  488.         *os << (os -> flags() & os -> showbase ? long_int.StringWithBase() : long_int.String());
  489.     }
  490.     else
  491.     {
  492.          os -> flush();
  493.          assert(! "know how to print signed long value in specified format yet !!!");
  494.     }
  495.  
  496.     return *this;
  497. }
  498.  
  499. Ostream &Ostream::operator<<(ULongInt a)
  500. {
  501.     if (os -> flags() & os -> dec)
  502.     {
  503.         ULongToDecString ulong_int(a);
  504.         *os << ulong_int.String();
  505.     }
  506.     else if (os -> flags() & os -> oct)
  507.     {
  508.         LongToOctString ulong_int(a);
  509.         *os << (os -> flags() & os -> showbase ? ulong_int.StringWithBase() : ulong_int.String());
  510.     }
  511.     else if (os -> flags() & os -> hex)
  512.     {
  513.         LongToHexString ulong_int(a);
  514.         *os << (os -> flags() & os -> showbase ? ulong_int.StringWithBase() : ulong_int.String());
  515.     }
  516.     else
  517.     {
  518.         os -> flush();
  519.         assert(! "know how to print unsigned long value in specified format yet !!!");
  520.     }
  521.  
  522.     return *this;
  523. }
  524.  
  525. wchar_t StringConstant::US_AND[]                        = {U_AM, U_NU}, // "&"
  526.         StringConstant::US_AND_AND[]                    = {U_AM, U_AM, U_NU}, // "&&"
  527.         StringConstant::US_AND_EQUAL[]                  = {U_AM, U_EQ, U_NU}, // "&="
  528.         StringConstant::US_COLON[]                      = {U_CO, U_NU}, // ":"
  529.         StringConstant::US_COMMA[]                      = {U_CM, U_NU}, // ","
  530.         StringConstant::US_DIVIDE[]                     = {U_SL, U_NU}, // "/"
  531.         StringConstant::US_DIVIDE_EQUAL[]               = {U_SL, U_EQ, U_NU}, // "/="
  532.         StringConstant::US_DOT[]                        = {U_DO, U_NU}, // "."
  533.         StringConstant::US_EMPTY[]                      = {U_NU}, // ""
  534.         StringConstant::US_EQUAL[]                      = {U_EQ, U_NU}, // "="
  535.         StringConstant::US_EQUAL_EQUAL[]                = {U_EQ, U_EQ, U_NU}, // "=="
  536.         StringConstant::US_GREATER[]                    = {U_GT, U_NU}, // ">"
  537.         StringConstant::US_GREATER_EQUAL[]              = {U_GT, U_EQ, U_NU}, // ">="
  538.         StringConstant::US_LBRACE[]                     = {U_OS, U_NU}, // "{"
  539.         StringConstant::US_LBRACKET[]                   = {U_LB, U_NU}, // "["
  540.         StringConstant::US_LEFT_SHIFT[]                 = {U_LT, U_LT, U_NU}, // "<<"
  541.         StringConstant::US_LEFT_SHIFT_EQUAL[]           = {U_LT, U_LT, U_EQ, U_NU}, // "<<="
  542.         StringConstant::US_LESS[]                       = {U_LT, U_NU}, // "<"
  543.         StringConstant::US_LESS_EQUAL[]                 = {U_LT, U_EQ, U_NU}, // "<="
  544.         StringConstant::US_LPAREN[]                     = {U_LP, U_NU}, // "("
  545.         StringConstant::US_MINUS[]                      = {U_MI, U_NU}, // "-"
  546.         StringConstant::US_MINUS_EQUAL[]                = {U_MI, U_EQ, U_NU}, // "-="
  547.         StringConstant::US_MINUS_MINUS[]                = {U_MI, U_MI, U_NU}, // "--"
  548.         StringConstant::US_MULTIPLY[]                   = {U_ST, U_NU}, // "*"
  549.         StringConstant::US_MULTIPLY_EQUAL[]             = {U_ST, U_EQ, U_NU}, // "*="
  550.         StringConstant::US_NOT[]                        = {U_EX, U_NU}, // "!"
  551.         StringConstant::US_NOT_EQUAL[]                  = {U_EX, U_EQ, U_NU}, // "!="
  552.         StringConstant::US_OR[]                         = {U_BA, U_NU}, // "|"
  553.         StringConstant::US_OR_EQUAL[]                   = {U_BA, U_EQ, U_NU}, // "|="
  554.         StringConstant::US_OR_OR[]                      = {U_BA, U_BA, U_NU}, // "||"
  555.         StringConstant::US_PLUS[]                       = {U_PL, U_NU}, // "+"
  556.         StringConstant::US_PLUS_EQUAL[]                 = {U_PL, U_EQ, U_NU}, // "+="
  557.         StringConstant::US_PLUS_PLUS[]                  = {U_PL, U_PL, U_NU}, // "++"
  558.         StringConstant::US_QUESTION[]                   = {U_QU, U_NU}, // "?"
  559.         StringConstant::US_RBRACE[]                     = {U_CS, U_NU}, // "}"
  560.         StringConstant::US_RBRACKET[]                   = {U_RB, U_NU}, // "]"
  561.         StringConstant::US_REMAINDER[]                  = {U_PE, U_NU}, // "%"
  562.         StringConstant::US_REMAINDER_EQUAL[]            = {U_PE, U_EQ, U_NU}, // "%="
  563.         StringConstant::US_RIGHT_SHIFT[]                = {U_GT, U_GT, U_NU}, // ">>"
  564.         StringConstant::US_RIGHT_SHIFT_EQUAL[]          = {U_GT, U_GT, U_EQ, U_NU}, // ">>="
  565.         StringConstant::US_RPAREN[]                     = {U_RP, U_NU}, // ")"
  566.         StringConstant::US_SEMICOLON[]                  = {U_SC, U_NU}, // ";"
  567.         StringConstant::US_TWIDDLE[]                    = {U_TI, U_NU}, // "~"
  568.         StringConstant::US_UNSIGNED_RIGHT_SHIFT[]       = {U_GT, U_GT, U_GT, U_NU}, // ">>>"
  569.         StringConstant::US_UNSIGNED_RIGHT_SHIFT_EQUAL[] = {U_GT, U_GT, U_GT, U_EQ, U_NU}, // ">>>="
  570.         StringConstant::US_XOR[]                        = {U_CA, U_NU}, // "^"
  571.         StringConstant::US_XOR_EQUAL[]                  = {U_CA, U_EQ, U_NU}, // "^="
  572.  
  573.         StringConstant::US_Boolean[] = {U_B, U_o, U_o, U_l, U_e, U_a, U_n, U_NU}, // "Boolean"
  574.         StringConstant::US_Byte[] = {U_B, U_y, U_t, U_e, U_NU}, // "Byte"
  575.         StringConstant::US_Character[] = {U_C, U_h, U_a, U_r, U_a, U_c, U_t, U_e, U_r, U_NU}, // "Character"
  576.         StringConstant::US_Class[] = {U_C, U_l, U_a, U_s, U_s, U_NU}, // "Class"
  577.         StringConstant::US_ClassNotFoundException[] = {U_C, U_l, U_a, U_s, U_s, U_N, U_o, U_t, U_F, U_o, U_u, U_n, U_d, U_E, U_x, U_c, U_e, U_p, U_t, U_i, U_o, U_n, U_NU}, // "ClassNotFoundException"
  578.         StringConstant::US_Cloneable[] = {U_C, U_l, U_o, U_n, U_e, U_a, U_b, U_l, U_e, U_NU}, // "Cloneable"
  579.         StringConstant::US_Double[] = {U_D, U_o, U_u, U_b, U_l, U_e, U_NU}, // "Double"
  580.         StringConstant::US_Error[] = {U_E, U_r, U_r, U_o, U_r, U_NU}, // "Error"
  581.         StringConstant::US_Exception[] = { U_E, U_x, U_c, U_e, U_p, U_t, U_i, U_o, U_n, U_NU}, // "Exception"
  582.         StringConstant::US_Float[] = {U_F, U_l, U_o, U_a, U_t, U_NU},  // "Float"
  583.         StringConstant::US_Integer[] = {U_I, U_n, U_t, U_e, U_g, U_e, U_r, U_NU}, // "Integer"
  584.         StringConstant::US_L[] = {U_L, U_NU}, // "L"
  585.         StringConstant::US_Long[]  = {U_L, U_o, U_n, U_g, U_NU}, // "Long"
  586.         StringConstant::US_NoClassDefFoundError[] = {U_N, U_o, U_C, U_l, U_a, U_s, U_s, U_D, U_e, U_f, U_F, U_o, U_u, U_n, U_d, U_E, U_r, U_r, U_o, U_r, U_NU}, // "NoClassDefFoundError"
  587.         StringConstant::US_Object[] = {U_O, U_b, U_j, U_e, U_c, U_t, U_NU}, // "Object"
  588.         StringConstant::US_PObject[] = {U_P, U_O, U_b, U_j, U_e, U_c, U_t, U_NU}, // "PObject"
  589.         StringConstant::US_RuntimeException[] = {U_R, U_u, U_n, U_t, U_i, U_m, U_e, U_E, U_x, U_c, U_e, U_p, U_t, U_i, U_o, U_n, U_NU}, // RuntimeException
  590.         StringConstant::US_Serializable[] = {U_S, U_e, U_r, U_i, U_a, U_l, U_i, U_z, U_a, U_b, U_l, U_e, U_NU}, // Serializable
  591.         StringConstant::US_Short[] = {U_S, U_h, U_o, U_r, U_t, U_NU}, // Short
  592.         StringConstant::US_StringBuffer[] = {U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_NU}, // StringBuffer
  593.         StringConstant::US_String[] = {U_S, U_t, U_r, U_i, U_n, U_g, U_NU}, // String
  594.         StringConstant::US_TYPE[] = {U_T, U_Y, U_P, U_E, U_NU}, // "TYPE"
  595.         StringConstant::US_Throwable[] = {U_T, U_h, U_r, U_o, U_w, U_a, U_b, U_l, U_e, U_NU}, // Throwable
  596.         StringConstant::US_Void[] = {U_V, U_o, U_i, U_d, U_NU}, // Void
  597.         StringConstant::US_Vector[] = {U_V, U_e, U_c, U_t, U_o, U_r, U_NU}, // Vector
  598.         StringConstant::US__DO[] = {U_DO, U_NU}, // "."
  599.         StringConstant::US__DO__DO[] = {U_DO, U_DO, U_NU}, // ".."
  600.         StringConstant::US__DS[] = {U_DS, U_NU}, // "$"
  601.         StringConstant::US__LB__RB[] = {U_LB, U_RB, U_NU}, // "[]"
  602.         StringConstant::US__LT_clinit_GT[] = {U_LT, U_c, U_l, U_i, U_n, U_i, U_t, U_GT, U_NU}, // "<clinit>"
  603.         StringConstant::US__LT_init_GT[] = {U_LT, U_i, U_n, U_i, U_t, U_GT, U_NU}, // "<init>"
  604.         StringConstant::US__QU__QU[] = {U_QU, U_QU, U_NU},  // "??"
  605.         StringConstant::US__SC[] = {U_SC, U_NU}, // ";"
  606.         StringConstant::US__SL[] = {U_SL, U_NU}, // "/"
  607.  
  608.         StringConstant::US__zip[] = {U_z, U_i, U_p, U_NU}, // "zip"
  609.         StringConstant::US__jar[] = {U_j, U_a, U_r, U_NU}, // "jar"
  610.  
  611.         StringConstant::US__array[] = {U_a, U_r, U_r, U_a, U_y, U_NU}, // "array"
  612.         StringConstant::US__access_DOLLAR[] = {U_a, U_c, U_c, U_e, U_s, U_s, U_DS, U_NU}, // "access$"
  613.         StringConstant::US__class_DOLLAR[] = {U_c, U_l, U_a, U_s, U_s, U_DS, U_NU}, // "class$"
  614.         StringConstant::US__constructor_DOLLAR[] = {U_c, U_o, U_n, U_s, U_t, U_r, U_u, U_c, U_t, U_o, U_r, U_DS, U_NU}, // "constructor$"
  615.         StringConstant::US__this_DOLLAR[] = {U_t, U_h, U_i, U_s, U_DS, U_NU}, // "this$"
  616.         StringConstant::US__val_DOLLAR[] = {U_v, U_a, U_l, U_DS, U_NU}, // "val$"
  617.  
  618.         StringConstant::US_abstract[] = {U_a, U_b, U_s, U_t, U_r, U_a, U_c, U_t, U_NU}, // "abstract"
  619.         StringConstant::US_append[] = {U_a, U_p, U_p, U_e, U_n, U_d, U_NU}, // "append"
  620.         StringConstant::US_block_DOLLAR[] = {U_b, U_l, U_o, U_c, U_k, U_DS, U_NU}, // "block$"
  621.         StringConstant::US_boolean[] = {U_b, U_o, U_o, U_l, U_e, U_a, U_n, U_NU}, // "boolean"
  622.         StringConstant::US_break[] = {U_b, U_r, U_e, U_a, U_k, U_NU}, // "break"
  623.         StringConstant::US_byte[] = {U_b, U_y, U_t, U_e, U_NU}, // "byte"
  624.         StringConstant::US_case[] = {U_c, U_a, U_s, U_e, U_NU}, // "case"
  625.         StringConstant::US_catch[] = {U_c, U_a, U_t, U_c, U_h, U_NU}, // "catch"
  626.         StringConstant::US_char[] = {U_c, U_h, U_a, U_r, U_NU}, // "char"
  627.         StringConstant::US_class[] = {U_c, U_l, U_a, U_s, U_s, U_NU}, // "class"
  628.         StringConstant::US_clone[] = {U_c, U_l, U_o, U_n, U_e, U_NU}, // "clone"
  629.         StringConstant::US_const[] = {U_c, U_o, U_n, U_s, U_t, U_NU}, // "const"
  630.         StringConstant::US_continue[] = {U_c, U_o, U_n, U_t, U_i, U_n, U_u, U_e, U_NU}, // "continue"
  631.         StringConstant::US_default[] = {U_d, U_e, U_f, U_a, U_u, U_l, U_t, U_NU}, // "default"
  632.         StringConstant::US_do[] = {U_d, U_o, U_NU}, // "do"
  633.         StringConstant::US_double[] = {U_d, U_o, U_u, U_b, U_l, U_e, U_NU}, // "double"
  634.         StringConstant::US_else[] = {U_e, U_l, U_s, U_e, U_NU}, // "else"
  635.         StringConstant::US_extends[] = {U_e, U_x, U_t, U_e, U_n, U_d, U_s, U_NU}, // "extends"
  636.         StringConstant::US_false[] = {U_f, U_a, U_l, U_s, U_e, U_NU}, // "false"
  637.         StringConstant::US_final[] = {U_f, U_i, U_n, U_a, U_l, U_NU}, // "final"
  638.         StringConstant::US_finally[] = {U_f, U_i, U_n, U_a, U_l, U_l, U_y, U_NU}, // "finally"
  639.         StringConstant::US_float[] = {U_f, U_l, U_o, U_a, U_t, U_NU}, // "float"
  640.         StringConstant::US_for[] = {U_f, U_o, U_r, U_NU}, // "for"
  641.         StringConstant::US_forName[] = {U_f, U_o, U_r, U_N, U_a, U_m, U_e, U_NU}, // "forName"
  642.         StringConstant::US_getMessage[] = {U_g, U_e, U_t, U_M, U_e, U_s, U_s, U_a, U_g, U_e, U_NU}, // "getMessage"
  643.         StringConstant::US_goto[] = {U_g, U_o, U_t, U_o, U_NU}, // "goto"
  644.         StringConstant::US_if[] = {U_i, U_f, U_NU}, // "if"
  645.         StringConstant::US_implements[] = {U_i, U_m, U_p, U_l, U_e, U_m, U_e, U_n, U_t, U_s, U_NU}, // "implements"
  646.         StringConstant::US_import[] = {U_i, U_m, U_p, U_o, U_r, U_t, U_NU}, // "import"
  647.         StringConstant::US_instanceof[] = {U_i, U_n, U_s, U_t, U_a, U_n, U_c, U_e, U_o, U_f, U_NU}, // "instanceof"
  648.         StringConstant::US_int[] = {U_i, U_n, U_t, U_NU}, // "int"
  649.         StringConstant::US_interface[] = {U_i, U_n, U_t, U_e, U_r, U_f, U_a, U_c, U_e, U_NU}, // "interface"
  650.         StringConstant::US_java_SL_io[] =  {U_j, U_a, U_v, U_a, U_SL, U_i, U_o, U_NU}, // "java/io"
  651.         StringConstant::US_java_SL_lang[] = {U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_NU}, // "java/lang"
  652.         StringConstant::US_java_SL_util[] = {U_j, U_a, U_v, U_a, U_SL, U_u, U_t, U_i, U_l, U_NU}, // "java/lang"
  653.         StringConstant::US_length[] = {U_l, U_e, U_n, U_g, U_t, U_h, U_NU}, // "length"
  654.         StringConstant::US_long[] = {U_l, U_o, U_n, U_g, U_NU}, // "long"
  655.         StringConstant::US_native[] = {U_n, U_a, U_t, U_i, U_v, U_e, U_NU}, // "native"
  656.         StringConstant::US_new[] = {U_n, U_e, U_w, U_NU}, // "new"
  657.         StringConstant::US_null[] = {U_n, U_u, U_l, U_l, U_NU}, // "null"
  658.         StringConstant::US_package[] = {U_p, U_a, U_c, U_k, U_a, U_g, U_e, U_NU}, // "package"
  659.         StringConstant::US_private[] = {U_p, U_r, U_i, U_v, U_a, U_t, U_e, U_NU}, // "private"
  660.         StringConstant::US_protected[] = {U_p, U_r, U_o, U_t, U_e, U_c, U_t, U_e, U_d, U_NU}, // "protected"
  661.         StringConstant::US_public[] = {U_p, U_u, U_b, U_l, U_i, U_c, U_NU}, // "public"
  662.         StringConstant::US_return[] = {U_r, U_e, U_t, U_u, U_r, U_n, U_NU}, // "return"
  663.         StringConstant::US_short[] = {U_s, U_h, U_o, U_r, U_t, U_NU}, // "short"
  664.         StringConstant::US_static[] = {U_s, U_t, U_a, U_t, U_i, U_c, U_NU}, // "static"
  665.         StringConstant::US_strictfp[] = {U_s, U_t, U_r, U_i, U_c, U_t, U_f, U_p, U_NU}, // "strictfp"
  666.         StringConstant::US_super[] = {U_s, U_u, U_p, U_e, U_r, U_NU}, // "super"
  667.         StringConstant::US_switch[] = {U_s, U_w, U_i, U_t, U_c, U_h, U_NU}, // "switch"
  668.         StringConstant::US_synchronized[] = {U_s, U_y, U_n, U_c, U_h, U_r, U_o, U_n, U_i, U_z, U_e, U_d, U_NU}, // "synchronized"
  669.         StringConstant::US_this0[] = {U_t, U_h, U_i, U_s, U_DS, U_0, U_NU}, // "this$0"
  670.         StringConstant::US_this[] = {U_t, U_h, U_i, U_s, U_NU}, // "this"
  671.         StringConstant::US_throw[] = {U_t, U_h, U_r, U_o, U_w, U_NU}, // "throw"
  672.         StringConstant::US_throws[] = {U_t, U_h, U_r, U_o, U_w, U_s, U_NU}, // "throws"
  673.         StringConstant::US_toString[] = {U_t, U_o, U_S, U_t, U_r, U_i, U_n, U_g, U_NU}, // "toString"
  674.         StringConstant::US_transient[] = {U_t, U_r, U_a, U_n, U_s, U_i, U_e, U_n, U_t, U_NU}, // "transient"
  675.         StringConstant::US_true[] = {U_t, U_r, U_u, U_e, U_NU}, // "true"
  676.         StringConstant::US_try[] = {U_t, U_r, U_y, U_NU}, // "try"
  677.         StringConstant::US_void[] = {U_v, U_o, U_i, U_d, U_NU}, // "void"
  678.         StringConstant::US_volatile[] = {U_v, U_o, U_l, U_a, U_t, U_i, U_l, U_e, U_NU}, // "volatile"
  679.         StringConstant::US_while[] = {U_w, U_h, U_i, U_l, U_e, U_NU}, // "while"
  680.  
  681.         StringConstant::US_EOF[] = {U_E, U_O, U_F, U_NU}; // "EOF"
  682.  
  683. wchar_t StringConstant::US_smallest_int[] = {U_MINUS, U_2, U_1, U_4, U_7, U_4, U_8, U_3, U_6, U_4, U_8, U_NU}; // "-2147483648"
  684.  
  685. char StringConstant::U8S_command_format[] = "use: jikes [-classpath path][-d dir][-debug][-depend|-Xdepend][-deprecation]"
  686.                                             "[-g][-nowarn][-nowrite][-O][-verbose][-Xstdout]"
  687.                                             "[+1.0][++][+B][+D][+E][+F][+K][+M][+P][+T][+U][+Z]"
  688.                                             " file.java...";
  689.  
  690. char StringConstant::U8S_B[] = {U_B,U_NU}, // "B"
  691.      StringConstant::U8S_C[] = {U_C,U_NU}, // "C"
  692.      StringConstant::U8S_Code[] = {U_C,U_o,U_d,U_e,U_NU}, // "Code"
  693.      StringConstant::U8S_ConstantValue[] = {U_C,U_o,U_n,U_s,U_t,U_a,U_n,U_t,U_V,U_a,U_l,U_u,U_e,U_NU}, // "ConstantValue"
  694.      StringConstant::U8S_D[] = {U_D,U_NU}, // "D"
  695.      StringConstant::U8S_Exceptions[] = {U_E,U_x,U_c,U_e,U_p,U_t,U_i,U_o,U_n,U_s,U_NU}, // "Exceptions"
  696.      StringConstant::U8S_F[] = {U_F,U_NU}, // "F"
  697.      StringConstant::U8S_I[] = {U_I,U_NU}, // "I"
  698.      StringConstant::U8S_InnerClasses[] = {U_I,U_n,U_n,U_e,U_r,U_C,U_l,U_a,U_s,U_s,U_e,U_s,U_NU}, // "InnerClasses"
  699.      StringConstant::U8S_J[] = {U_J,U_NU},  // "J"
  700.      StringConstant::U8S_LP_Ljava_SL_lang_SL_String_SC_RP_Ljava_SL_lang_SL_Class_SC[] = {U_LP,U_L,U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_S,U_t,U_r,U_i,U_n,U_g,U_SC,U_RP,U_L,U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_C,U_l,U_a,U_s,U_s,U_SC,U_NU}, // "(Ljava/lang/String;)Ljava/lang/Class;"
  701.      StringConstant::U8S_LP_Ljava_SL_lang_SL_String_SC_RP_V[] = {U_LP,U_L,U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_S,U_t,U_r,U_i,U_n,U_g,U_SC,U_RP,U_V,U_NU}, // "(Ljava/lang/String;)V"
  702.      StringConstant::U8S_LP_RP_Ljava_SL_lang_SL_String_SC[] = {U_LP,U_RP,U_L,U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_S,U_t,U_r,U_i,U_n,U_g,U_SC,U_NU}, // "()_Ljava/lang/String;"
  703.      StringConstant::U8S_LP_RP_V[] = {U_LP,U_RP,U_V,U_NU}, // "()V"
  704.      StringConstant::U8S_LineNumberTable[] = {U_L,U_i,U_n,U_e,U_N,U_u,U_m,U_b,U_e,U_r,U_T,U_a,U_b,U_l,U_e,U_NU}, // "LineNumberTable"
  705.      StringConstant::U8S_LocalVariableTable[] = {U_L,U_o,U_c,U_a,U_l,U_V,U_a,U_r,U_i,U_a,U_b,U_l,U_e,U_T,U_a,U_b,U_l,U_e,U_NU}, // "LocalVariableTable"
  706.      StringConstant::U8S_S[] = {U_S,U_NU}, // "S"
  707.      StringConstant::U8S_Sourcefile[] = {U_S,U_o,U_u,U_r,U_c,U_e,U_F,U_i,U_l,U_e,U_NU}, // "Sourcefile"
  708.      StringConstant::U8S_Synthetic[] = {U_S,U_y,U_n,U_t,U_h,U_e,U_t,U_i,U_c,U_NU}, // "Synthetic"
  709.      StringConstant::U8S_Deprecated[] = {U_D,U_e,U_p,U_r,U_e,U_c,U_a,U_t,U_e,U_d,U_NU}, // "Deprecated"
  710.      StringConstant::U8S_V[] = {U_V,U_NU}, // "V"
  711.      StringConstant::U8S_Z[] = {U_Z,U_NU}, // "Z"
  712.  
  713.      StringConstant::U8S__DO[] = {U_DO,U_NU}, // "."
  714.      StringConstant::U8S__DO_class[] = {U_DO,U_c,U_l,U_a,U_s,U_s,U_NU}, // ".class"
  715.      StringConstant::U8S__DO_java[] = {U_DO,U_j,U_a,U_v,U_a,U_NU}, // ".java"
  716.      StringConstant::U8S__DO_tok[] = {U_DO,U_t,U_o,U_k,U_NU}, // ".tok"
  717.      StringConstant::U8S__DO_u[] = {U_DO,U_u,U_NU}, // ".u"
  718.      StringConstant::U8S__LP[] = {U_LP,U_NU}, // "("
  719.      StringConstant::U8S__RP[] = {U_RP,U_NU}, // ")"
  720.      StringConstant::U8S__SL[] = {U_SL,U_NU}, // "/"
  721.      StringConstant::U8S__ST[] = {U_ST,U_NU}, // "*"
  722.  
  723.      StringConstant::U8S_class[] = {U_c,U_l,U_a,U_s,U_s,U_NU}, // "class"
  724.      StringConstant::U8S_java[] = {U_j,U_a,U_v,U_a,U_NU}, // "java"
  725.      StringConstant::U8S_java_SL_lang_SL_ClassNotFoundException[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_C,U_l,U_a,U_s,U_s,U_N,U_o,U_t,U_F,U_o,U_u,U_n,U_d,U_E,U_x,U_c,U_e,U_p,U_t,U_i,U_o,U_n,U_NU}, // "java/lang/ClassNotFoundException"
  726.      StringConstant::U8S_java_SL_lang_SL_Class[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_C,U_l,U_a,U_s,U_s,U_NU}, // "java/lang/Class"
  727.      StringConstant::U8S_java_SL_lang_SL_InternalError[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_I,U_n,U_t,U_e,U_r,U_n,U_a,U_l,U_E,U_r,U_r,U_o,U_r,U_NU}, // "java/lang/InternalError"
  728.      StringConstant::U8S_java_SL_lang_SL_NoClassDefFoundError[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_N,U_o,U_C,U_l,U_a,U_s,U_s,U_D,U_e,U_f,U_F,U_o,U_u,U_n,U_d,U_E,U_r,U_r,U_o,U_r,U_NU}, // "java/lang/NoClassDefFoundError"
  729.      StringConstant::U8S_java_SL_lang_SL_StringBuffer[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_S,U_t,U_r,U_i,U_n,U_g,U_B,U_u,U_f,U_f,U_e,U_r,U_NU}, // "java/lang/StringBuffer"
  730.      StringConstant::U8S_java_SL_lang_SL_Throwable[] = {U_j,U_a,U_v,U_a,U_SL,U_l,U_a,U_n,U_g,U_SL,U_T,U_h,U_r,U_o,U_w,U_a,U_b,U_l,U_e,U_NU}, // "java/lang/Throwable"
  731.      StringConstant::U8S_null[] = {U_n,U_u,U_l,U_l,U_NU}, // "null"
  732.      StringConstant::U8S_quit[] = {U_q,U_u,U_i,U_t,U_NU}, // "quit"
  733.      StringConstant::U8S_this[] = {U_t,U_h,U_i,U_s,U_NU}, // "this"
  734.  
  735.      StringConstant::U8S_LP_LB_C_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_LB, U_C, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  736.      StringConstant::U8S_LP_C_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_C, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  737.      StringConstant::U8S_LP_Z_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_Z, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  738.      StringConstant::U8S_LP_I_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_I, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  739.      StringConstant::U8S_LP_J_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_J, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  740.      StringConstant::U8S_LP_F_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_F, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  741.      StringConstant::U8S_LP_D_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_D, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  742.      StringConstant::U8S_LP_Ljava_SL_lang_SL_String_SC_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_SC, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU},
  743.      StringConstant::U8S_LP_Ljava_SL_lang_SL_Object_SC_RP_Ljava_SL_lang_SL_StringBuffer_SC[] = {U_LP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_O, U_b, U_j, U_e, U_c, U_t, U_SC, U_RP, U_L, U_j, U_a, U_v, U_a, U_SL, U_l, U_a, U_n, U_g, U_SL, U_S, U_t, U_r, U_i, U_n, U_g, U_B, U_u, U_f, U_f, U_e, U_r, U_SC, U_NU};
  744.  
  745. char StringConstant::U8S_smallest_int[] = {U_MINUS, U_2, U_1, U_4, U_7, U_4, U_8, U_3, U_6, U_4, U_8, U_NU}, // "-2147483648"
  746.      StringConstant::U8S_smallest_long_int[] = {U_MINUS, U_9, U_2, U_2, U_3, U_3, U_7, U_2, U_0, U_3, U_6,
  747.                                                          U_8, U_5, U_4, U_7, U_7, U_5, U_8, U_0, U_8, U_NU}; // "-9223372036854775808"
  748.  
  749. int StringConstant::U8S_ConstantValue_length = strlen(U8S_ConstantValue),
  750.     StringConstant::U8S_Exceptions_length = strlen(U8S_Exceptions),
  751.     StringConstant::U8S_InnerClasses_length = strlen(U8S_InnerClasses),
  752.     StringConstant::U8S_Synthetic_length = strlen(U8S_Synthetic),
  753.     StringConstant::U8S_Deprecated_length = strlen(U8S_Deprecated),
  754.     StringConstant::U8S_LineNumberTable_length = strlen(U8S_LineNumberTable),
  755.     StringConstant::U8S_LocalVariableTable_length = strlen(U8S_LocalVariableTable),
  756.     StringConstant::U8S_Code_length = strlen(U8S_Code),
  757.     StringConstant::U8S_Sourcefile_length = strlen(U8S_Sourcefile),
  758.  
  759.     StringConstant::U8S_null_length = strlen(U8S_null),
  760.     StringConstant::U8S_this_length = strlen(U8S_this);
  761.  
  762. //
  763. // If the system runs out of memory, this function is invoked
  764. //
  765. #ifdef MICROSOFT
  766.     int OutOfMemory(size_t)
  767.     {
  768.         fprintf(stderr, "***System Failure: Out of memory\n");
  769.         exit(1);
  770.  
  771.         return 0;
  772.     }
  773.  
  774.     void SetNewHandler()
  775.     {
  776.         _set_new_handler(OutOfMemory);
  777.     }
  778. #else
  779.     void OutOfMemory()
  780.     {
  781.         fprintf(stderr, "***System Failure: Out of memory\n");
  782.         exit(1);
  783.     }
  784.  
  785.     void SetNewHandler()
  786.     {
  787.         set_new_handler(OutOfMemory);
  788.     }
  789. #endif
  790.  
  791. //
  792. // When using the ICC compiler on Win95 or OS/2, we need to disable
  793. // testing for various floating point exceptions. Default behavior
  794. // was causing problems reading some standard class files.
  795. //
  796. #ifdef ICC
  797. #include <float.h>
  798.     void FloatingPointCheck()
  799.     {
  800.         _control87(EM_UNDERFLOW, EM_UNDERFLOW);
  801.         _control87(EM_ZERODIVIDE, EM_ZERODIVIDE);
  802.         _control87(EM_OVERFLOW, EM_OVERFLOW);
  803.         _control87(EM_INVALID, EM_INVALID);
  804.  
  805.         return;
  806.     }
  807. #else
  808.     void FloatingPointCheck() {}
  809. #endif
  810.  
  811.     int SystemStat(const char *name, struct stat *stat_struct)
  812.     {
  813.         return stat(name, stat_struct);
  814.     }
  815.     FILE *SystemFopen(char *name, char *mode)
  816.     {
  817.         return fopen(name, mode);
  818.     }
  819.     size_t SystemFread(char *ptr, size_t element_size, size_t count, FILE *stream)
  820.     {
  821.         return fread(ptr, element_size, count, stream);
  822.     }
  823.     int SystemIsDirectory(char *name)
  824.     {
  825.         struct stat status;
  826.         return (((::SystemStat(name, &status) == 0) && (status.st_mode & STAT_S_IFDIR)) ? 1 : 0);
  827.     }
  828.  
  829. #if defined(GNU_LIBC5) || defined __amigaos__
  830. #include <sys/stat.h>
  831. #ifndef UNIX
  832.     int SystemMkdir(char *dirname)
  833.     {
  834.         return mkdir(dirname, S_IRWXU);
  835.     }
  836. #endif
  837.  
  838. #elif defined(WIN32_FILE_SYSTEM)
  839. #include <direct.h>
  840.     int SystemMkdir(char *dirname)
  841.     {
  842.         return mkdir(dirname);
  843.     }
  844. #endif
  845.  
  846.  
  847. //
  848. // The configure script check each of these to see if we need our own implementation
  849. //
  850.  
  851. #ifndef HAVE_WCSLEN
  852.     size_t wcslen(wchar_t *cs)
  853.     {
  854.         int n = 0;
  855.         while (*cs++)
  856.             n++;
  857.  
  858.         return n;
  859.     }
  860. #endif
  861.  
  862. #ifndef HAVE_WCSCPY
  863.     wchar_t *wcscpy(wchar_t *s, wchar_t *ct)
  864.     {
  865.         wchar_t *ptr;
  866.         for (ptr = s; *ct; ptr++, ct++)
  867.             *ptr = *ct;
  868.         *ptr = U_NULL;
  869.  
  870.         return s;
  871.     }
  872. #endif
  873.  
  874. #ifndef HAVE_WCSNCPY
  875.     wchar_t *wcsncpy(wchar_t *s, wchar_t *ct, int n)
  876.     {
  877.         wchar_t *ptr;
  878.         for (ptr = s; *ct && n-- > 0; ptr++, ct++)
  879.             *ptr = *ct;
  880.         while (n-- > 0)
  881.             *ptr++ = U_NULL;
  882.  
  883.         return s;
  884.     }
  885. #endif
  886.  
  887. #ifndef HAVE_WCSCAT
  888.     wchar_t *wcscat(wchar_t *s, wchar_t *ct)
  889.     {
  890.         wchar_t *ptr = s;
  891.  
  892.         while (*ptr)
  893.             ptr++;
  894.         wcscpy(ptr, ct);
  895.  
  896.         return s;
  897.     }
  898. #endif
  899.  
  900. #ifndef HAVE_WCSCMP
  901.     int wcscmp(wchar_t *cs, wchar_t *ct)
  902.     {
  903.         while (*cs == *ct && *cs && *ct)
  904.         {
  905.             cs++;
  906.             ct++;
  907.         }
  908.  
  909.         return (*cs == *ct ? 0 : (*cs < *ct ? -1 : 1));
  910.     }
  911. #endif
  912.  
  913. #ifndef HAVE_WCSNCMP
  914.     int wcsncmp(wchar_t *cs, wchar_t *ct, int n)
  915.     {
  916.         while (*cs == *ct && *cs && *ct && n-- > 0)
  917.         {
  918.             cs++;
  919.             ct++;
  920.         }
  921.  
  922.         return (n <= 0 || *cs == *ct ? 0 : (*cs < *ct ? -1 : 1));
  923.     }
  924. #endif
  925.  
  926. #ifdef __OS2__
  927. // changes for OS/2 from John Price, jgprice@ozemail.com.au, 2/99
  928. #include <direct.h>
  929.     int SystemMkdir(char *dirname)
  930.     {
  931.         return mkdir(dirname);
  932.     }
  933. #endif
  934.  
  935. #ifdef UNIX
  936.     char PathSeparator() { return U_COLON; } // ":"
  937.  
  938.     int SystemMkdir(char *dirname)
  939.     {
  940.         return mkdir(dirname, S_IRWXU | S_IRWXG | S_IRWXO);
  941.     }
  942. #else
  943.     char PathSeparator() { return U_SEMICOLON; } // ";"
  944. #endif
  945.  
  946. int SystemMkdirhier(char *dirname)
  947. {
  948.     if (::SystemIsDirectory(dirname))
  949.         return 0;
  950.  
  951.     for (char *ptr = dirname; *ptr; ptr++)
  952.     {
  953.         char delimiter = *ptr;
  954.         if (delimiter == U_SLASH)
  955.         {
  956.             *ptr = U_NULL;
  957.  
  958.             if (! ::SystemIsDirectory(dirname))
  959.                 ::SystemMkdir(dirname);
  960.  
  961.             *ptr = delimiter;
  962.         }
  963.     }
  964.  
  965.     ::SystemMkdir(dirname);
  966.     
  967.     return (! ::SystemIsDirectory(dirname));
  968. }
  969.  
  970.  
  971. // These next two should definitely be inlined; but when I add "inline", I
  972. // get linker problems.
  973.  
  974.  
  975. // Given three strings, return a newly-allocated string which is their concatenation.
  976. char * strcat3(const char * prefix, const char * middle, const char * suffix) {
  977.   int prefix_len = strlen(prefix);
  978.   int prefix_middle_len = prefix_len + strlen(middle);
  979.  
  980.   char * result = new char[prefix_middle_len + strlen(suffix) + 1];
  981.   strcpy(result, prefix);
  982.   // The below is more efficient than this commented-out code.
  983.   // strcat(result, middle);
  984.   // strcat(result, suffix);
  985.   strcpy(result + prefix_len, middle);
  986.   strcpy(result + prefix_middle_len, suffix);
  987.   return result;
  988. }
  989.  
  990. // It's inconceivable that this is the right way to go about this.
  991. // One alternative is to use ConvertUnicodeToUtf8.
  992. char * wstring2string(wchar_t * in) {
  993.   char * result = new char[wcslen(in) + 1];
  994.   result[wcslen(in)] = 0;
  995.   for (size_t i=0; i<wcslen(in); i++) {
  996.     wchar_t ch = in[i];
  997.     result[i] = (ch >> 8 == 0 ? (char)ch : '?');
  998.   }
  999.   return result;
  1000. }
  1001.  
  1002. Ostream Coutput;
  1003.